#!/usr/bin/env bash

export RBXOPT

rbx_options_trim()
{
  RBXOPT="${RBXOPT## }"
  RBXOPT="${RBXOPT%% }"
}

rbx_options_append()
{
  for param in "$@"
  do
    if [[ " ${RBXOPT} " != *" $param "* ]]
    then
      RBXOPT="${RBXOPT} $param"
    fi
  done
  rbx_options_trim
}

rbx_options_remove()
{
  RBXOPT=" ${RBXOPT} "
  for param in "$@"
  do
    if [[ "${RBXOPT}" == *" $param "* ]]
    then
      RBXOPT="${RBXOPT// $param / }"
    fi
  done
  rbx_options_trim
}

rbx_clean_project_options()
{
  if [[ -n "${PROJECT_RBXOPT}" ]]
  then
    unset PROJECT_RBXOPT
  fi
}
